package com.ms.common.enums;

public enum RedisKeyEnum {

    CODE_CODE("code:code", "编码缓存业务"),
    COMMON_CODE("common:all", "默认返回值"),
    ;

    private final String value;
    private final String text;

    private RedisKeyEnum(String value, String text) {
        this.value = value;
        this.text = text;
    }

    public String getValue() {
        return value;
    }

    public String getText() {
        return text;
    }

    private static final RedisKeyEnum[] ENUMS = RedisKeyEnum.values();

    public static RedisKeyEnum matchEnum(String value) {
        for (RedisKeyEnum ele : ENUMS) {
            if (ele.value == value) {
                return ele;
            }
        }
        return RedisKeyEnum.COMMON_CODE;
    }
}
